package com.wlanauth.dao.radius.impl;

import java.util.Date;
import java.util.List;

import com.wlanauth.dao.common.impl.CommonDaoImpl;
import com.wlanauth.dao.radius.RadRatioDao;
import com.wlanauth.domain.radius.RadRatio;

public class RadRatioDaoImpl extends CommonDaoImpl<RadRatio> implements RadRatioDao{
	
	
	@SuppressWarnings("unchecked")
	public RadRatio getRadRatio(Date time) {
		
		String hql = "from RadRatio r where r.effectTime<=? order by effectTime desc limit 1";
		
		List<RadRatio> list = this.getHibernateTemplate().find(hql,new Object[]{time});
		if(list == null||list.size()<1){
			return null;
		}
		return list.get(0);
	}

	
}
